<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/common.min.css">
    <link rel="stylesheet" href="../css/login_register.min.css">
</head>

<body>
    <header>
        <img src="../images/1.png" alt="">

    </header>
    <main>
        <div class="head">
            用户登录
        </div>

        <div class="two" id="inp1">
            <span>登录账号:</span> <input type="text" id="inp3">
        </div>
        <div class="two" id="inp2">
            <span>登录密码:</span> <input type="password" id="inp4">
        </div>

        <div class="but">
            <button id="btn">登录</button><a href="./register.html">没有账号？前往注册</a>
        </div>
    </main>

    <script src="./bootstrap/jquery-3.0.0/jquery-3.0.0.js"></script>
    <script>
        $("#btn").click(function () {
            let username = $("#inp3").val();
            let password = $("#inp4").val();
            $.ajax({
                url: '/users/login',
                type: "POST",
                data: {
                    username, password
                },
                success:function(res){
                    console.log(res);

                    if(res.code){
                        alert('登陆成功')
                    }
                    else{
                        alert('登陆失败')
                    }
                }

            })
        })


    </script>
</body>

</html>